package com.itheima.app.interceptor;

import com.itheima.domain.db.User;

//用户持有者-工具类
public class UserHolder {
    private static final ThreadLocal<User> TL = new ThreadLocal<>();

    //将用户绑定到当前线程上
    public static void set(User user){
        TL.set(user);
    }

    //获取当前线程上绑定的用户
    public static User get(){
        return TL.get();
    }

    //将用户和当前线程进行解绑
    public static void remove(){
        TL.remove();
    }
}
